﻿
$(function () {
    gridList();
    $("#btn_search").click(function () {
        //SearchUser();
    });
});

function gridList() {
    var $gridList = $("#gridList");
    $gridList.dataGrid({
        mtype: 'post',
        url: "/Account/User/GetUserList",
        height: $(window).height() - 150,
        colModel: [
            {
                label: "主键",
                name: "Id",
                hidden: true,
                key: true
            },
            { label: '真实姓名', name: 'RealName', width: fixJqgridColumnWidthByPercent(0.08), align: 'center' },
            { label: '用户名', name: 'UserName', width: fixJqgridColumnWidthByPercent(0.08), align: 'center' },
            { label: '性别', name: 'Sex', width: fixJqgridColumnWidthByPercent(0.08), align: 'center' },
            {
                label: "手机号",
                name: "Mobile",
                width: fixJqgridColumnWidthByPercent(0.13),
                align: "center"

            },
            {
                label: '角色',
                name: 'RoleName',
                width: fixJqgridColumnWidthByPercent(0.13),
                align: 'center',
            },
            {
                label: "是否启用",
                name: "IsUsed",
                width: fixJqgridColumnWidthByPercent(0.06),
                align: "center",
                formatter: function (cellvalue, options, rowObject) {
                    if (cellvalue == true) {
                        return '<i class="fa fa-toggle-on" onclick="return Activation(' +
                            rowObject.Id +
                            ',' +
                            rowObject.IsUsed +
                            ');" ></i>';
                    } else {
                        return '<i class="fa fa-toggle-off" onclick="return Activation(' +
                            rowObject.Id +
                            ',' +
                            rowObject.IsUsed +
                            ');"  ></i>';
                    }
                }
            },
        ],
        pager: '#gridPager',
        viewrecords: true,
        multiselect: true,
        loadComplete: function () {
            //setGridSearchDataStr();
        }
    });
}